inherited fmRequest: TfmRequest
  Left = 465
  Top = 197
  Width = 1081
  Height = 667
  Caption = #1047#1072#1103#1074#1082#1080' '#1085#1072' '#1086#1082#1072#1079#1072#1085#1080#1077' '#1091#1089#1083#1091#1075
  Constraints.MinHeight = 667
  Constraints.MinWidth = 1081
  OnShow = FormShow
  PixelsPerInch = 96
  TextHeight = 13
  inherited sbBottom: TStatusBar
    Top = 602
    Width = 1065
  end
  inherited Panel1: TPanel
    Width = 1065
    Visible = False
    inherited BitBtn1: TBitBtn
      Left = 903
    end
    inherited BitBtn2: TBitBtn
      Left = 991
    end
  end
  object ToolBar1: TToolBar [2]
    Left = 0
    Top = 45
    Width = 1065
    Height = 29
    ButtonWidth = 26
    Caption = 'ToolBar1'
    Images = DMInv.ilActive
    TabOrder = 2
    object tbAddR: TToolButton
      Left = 0
      Top = 2
      Hint = #1057#1086#1079#1076#1072#1090#1100' '#1079#1072#1103#1074#1082#1091
      Caption = 'tbAddR'
      Enabled = False
      ImageIndex = 28
      ParentShowHint = False
      ShowHint = True
      OnClick = tbAddRClick
    end
    object tbEditR: TToolButton
      Left = 26
      Top = 2
      Hint = #1056#1077#1076#1072#1082#1090#1080#1088#1086#1074#1072#1090#1100' '#1079#1072#1103#1074#1082#1091
      Caption = 'tbEditR'
      Enabled = False
      ImageIndex = 2
      ParentShowHint = False
      ShowHint = True
      OnClick = tbEditRClick
    end
    object tbDelR: TToolButton
      Left = 52
      Top = 2
      Hint = #1059#1076#1072#1083#1080#1090#1100' '#1079#1072#1103#1074#1082#1091
      Caption = 'tbDelR'
      Enabled = False
      ImageIndex = 29
      ParentShowHint = False
      ShowHint = True
      OnClick = tbDelRClick
    end
    object ToolButton1: TToolButton
      Left = 78
      Top = 2
      Width = 8
      Caption = 'ToolButton1'
      ImageIndex = 30
      Style = tbsSeparator
    end
    object tbPrint: TToolButton
      Left = 86
      Top = 2
      Hint = #1055#1077#1095#1072#1090#1100' '#1079#1072#1103#1074#1082#1080
      Caption = 'tbPrint'
      ImageIndex = 11
      ParentShowHint = False
      ShowHint = True
      Visible = False
      OnClick = tbPrintClick
    end
    object bGridCust: TcxButton
      Tag = 12
      Left = 112
      Top = 2
      Width = 27
      Height = 22
      Hint = #1050#1086#1083#1086#1085#1082#1080' '#1090#1072#1073#1083#1080#1094#1099
      ParentShowHint = False
      ShowHint = True
      TabOrder = 0
      TabStop = False
      OnClick = bGridCustClick
      Glyph.Data = {
        76010000424D7601000000000000760000002800000020000000100000000100
        04000000000000010000120B0000120B00001000000000000000000000000000
        80000080000000808000800000008000800080800000C0C0C000808080000000
        FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
        33333FFFFFFFFFFFFFFF000000000000000088888888888888880FFFFFFFFFFF
        FFF08F3FF3FF3FF7FFF80F00F00F00F900F08F883883883788380FFFFFFFF9FF
        FFF08F3FF3FF37F3FFF80F00F00F09F000F08F883883873888380FFFFFFFF99F
        FFF08F3FF3FF3773FFF80F00F99909F000F08F883777873888380FFFF9FFF999
        FFF08F3FF7FF3777FFF80F00F99F00F000F08F88377388388838099FF9FFFFFF
        FFF0877FF7FFFFFFFFF809C9C999CCCCCCC087878777888888880979CCCCCCCC
        C77087F7888888888FF809090000000000008787888888888888399333333333
        3333377333333333333333333333333333333333333333333333}
      LookAndFeel.SkinName = 'Blue'
      NumGlyphs = 2
    end
    object ToolButton2: TToolButton
      Left = 139
      Top = 2
      Width = 8
      Caption = 'ToolButton2'
      ImageIndex = 12
      Style = tbsSeparator
    end
    object cbReqType: TcxComboBox
      Left = 147
      Top = 2
      Properties.Items.Strings = (
        #1042#1089#1077
        #1053#1077#1088#1072#1089#1089#1084#1086#1090#1088#1077#1085#1085#1099#1077
        #1054#1090#1082#1072#1079#1099
        #1057#1086#1079#1076#1072#1085#1086' '#1076#1086#1087'. '#1089#1086#1075#1083#1072#1096#1077#1085#1080#1077
        #1059#1076#1072#1083#1077#1085#1086' '#1076#1086#1087'. '#1089#1086#1075#1083#1072#1096#1077#1085#1080#1077)
      Properties.OnCloseUp = cbReqTypePropertiesCloseUp
      TabOrder = 3
      Text = #1053#1077#1088#1072#1089#1089#1084#1086#1090#1088#1077#1085#1085#1099#1077
      Width = 180
    end
    object ToolButton3: TToolButton
      Left = 327
      Top = 2
      Width = 8
      Caption = 'ToolButton3'
      ImageIndex = 13
      Style = tbsSeparator
    end
    object bOtkaz: TcxButton
      Tag = 12
      Left = 335
      Top = 2
      Width = 99
      Height = 22
      Hint = #1054#1090#1082#1072#1079
      Caption = #1054#1090#1082#1072#1079#1072#1090#1100
      ParentShowHint = False
      ShowHint = True
      TabOrder = 1
      TabStop = False
      Visible = False
      OnClick = bOtkazClick
      LookAndFeel.SkinName = 'Office2007Pink'
    end
    object bCreateSC: TcxButton
      Tag = 12
      Left = 434
      Top = 2
      Width = 131
      Height = 22
      Hint = #1057#1086#1079#1076#1072#1090#1100' '#1076#1086#1087'. '#1089#1086#1075#1083#1072#1096'.'
      Caption = #1057#1086#1079#1076#1072#1090#1100' '#1076#1086#1087'. '#1089#1086#1075#1083#1072#1096'.'
      ParentShowHint = False
      ShowHint = True
      TabOrder = 2
      TabStop = False
      Visible = False
      OnClick = bCreateSCClick
      LookAndFeel.SkinName = 'Office2007Green'
    end
  end
  object dbgR: TcxGrid [3]
    Left = 0
    Top = 74
    Width = 1065
    Height = 528
    Align = alClient
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -13
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
    TabOrder = 3
    LookAndFeel.Kind = lfStandard
    object tvR: TcxGridDBTableView
      NavigatorButtons.ConfirmDelete = False
      NavigatorButtons.PriorPage.Visible = True
      NavigatorButtons.Next.Visible = True
      NavigatorButtons.Insert.Visible = True
      NavigatorButtons.Append.Visible = False
      NavigatorButtons.Edit.Visible = False
      NavigatorButtons.Post.Visible = True
      NavigatorButtons.Cancel.Visible = False
      NavigatorButtons.Refresh.Visible = False
      NavigatorButtons.SaveBookmark.Visible = False
      NavigatorButtons.GotoBookmark.Visible = False
      NavigatorButtons.Filter.Visible = False
      FilterBox.Position = fpTop
      OnCellDblClick = tvRCellDblClick
      DataController.DataSource = dlgDS
      DataController.Summary.DefaultGroupSummaryItems = <>
      DataController.Summary.FooterSummaryItems = <
        item
          Kind = skCount
          FieldName = 'RID'
          Column = tvRRID
        end>
      DataController.Summary.SummaryGroups = <>
      Filtering.ColumnFilteredItemsList = True
      OptionsBehavior.CellHints = True
      OptionsBehavior.IncSearch = True
      OptionsCustomize.ColumnFiltering = False
      OptionsData.CancelOnExit = False
      OptionsData.Editing = False
      OptionsView.CellEndEllipsis = True
      OptionsView.CellAutoHeight = True
      OptionsView.CellTextMaxLineCount = 1
      OptionsView.ColumnAutoWidth = True
      OptionsView.Footer = True
      OptionsView.GroupFooters = gfVisibleWhenExpanded
      OptionsView.HeaderEndEllipsis = True
      OptionsView.Indicator = True
      Preview.Visible = True
      Styles.Header = DMInv.cxSiniyText
      object tvRRID: TcxGridDBColumn
        Caption = #8470
        DataBinding.FieldName = 'RID'
        Width = 20
      end
      object tvRFIO_POLUCH: TcxGridDBColumn
        Caption = #1060#1048#1054' '#1087#1086#1083#1091#1095'. '#1091#1089#1083'.'
        DataBinding.FieldName = 'FIO_POLUCH'
        Width = 25
      end
      object tvRPODR: TcxGridDBColumn
        Caption = #1054#1089#1085'. '#1087#1086#1076#1088'.'
        DataBinding.FieldName = 'PODR'
        Width = 20
      end
      object tvRFIO_DL: TcxGridDBColumn
        Caption = #1060#1048#1054' '#1076#1086#1074'. '#1083#1080#1094#1072
        DataBinding.FieldName = 'FIO_DL'
        Width = 22
      end
      object tvRRTIMEENTER: TcxGridDBColumn
        Caption = #1047#1072#1103#1074#1082#1072' '#1089#1086#1079#1076#1072#1085#1072
        DataBinding.FieldName = 'RTIMEENTER'
        Width = 22
      end
      object tvRRTIMEEDIT: TcxGridDBColumn
        Caption = #1047#1072#1103#1074#1082#1072'. '#1086#1090#1088#1077#1076#1072#1082#1090'.'
        DataBinding.FieldName = 'RTIMEEDIT'
        Width = 29
      end
      object tvRRNOTE: TcxGridDBColumn
        Caption = #1050#1086#1084#1084#1077#1085#1090' '#1082' '#1079#1072#1103#1074#1082#1077
        DataBinding.FieldName = 'RNOTE'
        Width = 26
      end
      object tvRRDATE: TcxGridDBColumn
        Caption = #1044#1072#1090#1072' '#1079#1072#1103#1074#1083'.'
        DataBinding.FieldName = 'RDATE'
        Width = 23
      end
      object tvRSCID: TcxGridDBColumn
        Caption = #8470' '#1076#1086#1087'. '#1089#1086#1075#1083'.'
        DataBinding.FieldName = 'SCID'
        Visible = False
        Width = 20
      end
      object tvRRDNOTE: TcxGridDBColumn
        Caption = #1050#1086#1084#1084#1077#1085#1090' '#1082' '#1091#1089#1083#1091#1075#1077
        DataBinding.FieldName = 'RDNOTE'
        Width = 33
      end
      object tvRRDBEGIN: TcxGridDBColumn
        Caption = #1053#1072#1095#1072#1083#1086' '#1091#1089#1083#1091#1075#1080
        DataBinding.FieldName = 'RDBEGIN'
        Width = 35
      end
      object tvRRDEND: TcxGridDBColumn
        Caption = #1050#1086#1085#1077#1094' '#1091#1089#1083#1091#1075#1080
        DataBinding.FieldName = 'RDEND'
        Width = 34
      end
      object tvRRDCOUNT: TcxGridDBColumn
        Caption = #1050#1086#1083#1080#1095'. '#1091#1089#1083#1091#1075
        DataBinding.FieldName = 'RDCOUNT'
        Width = 37
      end
      object tvRRDISOTKAZ: TcxGridDBColumn
        Caption = #1054#1090#1082#1072#1079
        DataBinding.FieldName = 'RDISOTKAZ'
        Visible = False
        Width = 20
      end
      object tvRUSLUGA: TcxGridDBColumn
        Caption = #1059#1089#1083#1091#1075#1072
        DataBinding.FieldName = 'USLUGA'
        Width = 24
      end
      object tvRSOST: TcxGridDBColumn
        Caption = #1057#1086#1089#1090#1086#1103#1085#1080#1077
        DataBinding.FieldName = 'SOST'
        Width = 35
      end
      object tvRSOST_AUTOR: TcxGridDBColumn
        Caption = #1040#1074#1090#1086#1088' '#1089#1086#1089#1090#1086#1103#1085#1080#1103
        DataBinding.FieldName = 'SOST_AUTOR'
        Width = 58
      end
      object tvRSCTIMEENTER: TcxGridDBColumn
        Caption = #1044#1072#1090#1072' '#1089#1086#1079#1076'. '#1076#1086#1087#1089#1086#1075#1083#1072#1096#1077#1085#1080#1103'. '
        DataBinding.FieldName = 'SCTIMEENTER'
        Width = 107
      end
      object tvRAUTOR_OTKAZA: TcxGridDBColumn
        Caption = #1040#1074#1090#1086#1088' '#1086#1090#1082#1072#1079#1072
        DataBinding.FieldName = 'AUTOR_OTKAZA'
        Visible = False
        Width = 47
      end
      object tvRAUTOR_SC: TcxGridDBColumn
        Caption = #1040#1074#1090#1086#1088' '#1076#1086#1087' '#1089#1086#1075#1083#1072#1096'.'
        DataBinding.FieldName = 'AUTOR_SC'
        Visible = False
        Width = 70
      end
      object tvRUDALIL_SC: TcxGridDBColumn
        Caption = #1059#1076#1072#1083#1080#1083' '#1076#1086#1087'. '#1089#1086#1075#1083#1072#1096'.'
        DataBinding.FieldName = 'UDALIL_SC'
        Visible = False
        Width = 113
      end
      object tvRSCAN1: TcxGridDBColumn
        Caption = #1050#1086#1087#1080#1103' '#1087#1077#1088#1074'.'
        DataBinding.FieldName = 'SCAN1'
        PropertiesClassName = 'TcxCheckBoxProperties'
        Properties.NullStyle = nssUnchecked
        Properties.ValueChecked = 1
        Properties.ValueUnchecked = 0
        Options.Editing = False
        Width = 59
      end
      object tvRSCAN2: TcxGridDBColumn
        Caption = #1050#1086#1087#1080#1103' '#1088#1077#1075'.'
        DataBinding.FieldName = 'SCAN2'
        PropertiesClassName = 'TcxCheckBoxProperties'
        Properties.NullStyle = nssUnchecked
        Properties.ValueChecked = 1
        Properties.ValueUnchecked = 0
        Options.Editing = False
        Width = 61
      end
    end
    object cxGridLevel2: TcxGridLevel
      GridView = tvR
    end
  end
  object Panel_agr: TPanel [4]
    Left = 24
    Top = 100
    Width = 1009
    Height = 185
    Caption = 'Panel_agr'
    Color = clPurple
    TabOrder = 4
    Visible = False
    object dbgAgr: TcxGrid
      Left = 1
      Top = 24
      Width = 1007
      Height = 160
      Align = alClient
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -13
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
      TabOrder = 0
      LookAndFeel.Kind = lfStandard
      object tvAgr: TcxGridDBTableView
        NavigatorButtons.ConfirmDelete = False
        OnCellDblClick = tvAgrCellDblClick
        DataController.DataSource = dsAgr
        DataController.Summary.DefaultGroupSummaryItems = <>
        DataController.Summary.FooterSummaryItems = <>
        DataController.Summary.SummaryGroups = <>
        OptionsBehavior.CellHints = True
        OptionsCustomize.ColumnFiltering = False
        OptionsData.CancelOnExit = False
        OptionsData.Deleting = False
        OptionsData.DeletingConfirmation = False
        OptionsData.Editing = False
        OptionsData.Inserting = False
        OptionsView.CellEndEllipsis = True
        OptionsView.CellAutoHeight = True
        OptionsView.CellTextMaxLineCount = 1
        OptionsView.ColumnAutoWidth = True
        OptionsView.GroupByBox = False
        OptionsView.HeaderEndEllipsis = True
        Preview.Visible = True
        Styles.Header = DMInv.cxSiniyText
        object tvAgrColumn1: TcxGridDBColumn
          Caption = #8470
          Options.Sorting = False
          Width = 35
        end
        object tvAgrAGID: TcxGridDBColumn
          Caption = #8470' '#1089#1082#1074#1086#1079#1085'.'
          DataBinding.FieldName = 'AGID'
        end
        object tvAgrP_RECIPIENT: TcxGridDBColumn
          Caption = #1055#1086#1083#1091#1095'. '#1091#1089#1083#1091#1075
          DataBinding.FieldName = 'P_RECIPIENT'
          Width = 182
        end
        object tvAgrAGNUM_N: TcxGridDBColumn
          Caption = #1053#1086#1084#1077#1088
          DataBinding.FieldName = 'AGNUM_N'
          Width = 78
        end
        object tvAgrAGNUM: TcxGridDBColumn
          Caption = #8470' '#1085#1072' '#1076#1086#1082'.'
          DataBinding.FieldName = 'AGNUM'
          Width = 78
        end
        object tvAgrLIST: TcxGridDBColumn
          Caption = #1055#1086#1076#1087#1080#1089#1072#1085#1090#1099
          DataBinding.FieldName = 'LIST'
          Width = 77
        end
        object tvAgrAGDATEBEGIN: TcxGridDBColumn
          Caption = #1044#1072#1090#1072' '#1087#1086#1076#1087'.'
          DataBinding.FieldName = 'AGDATEBEGIN'
          Width = 79
        end
        object tvAgrAGDATE: TcxGridDBColumn
          Caption = #1044#1072#1090#1072' '#1074#1089#1090'. '#1074' '#1089#1080#1083#1091
          DataBinding.FieldName = 'AGDATE'
          Width = 78
        end
        object tvAgrAGDATEEND: TcxGridDBColumn
          Caption = #1044#1072#1090#1072' '#1079#1072#1074#1077#1088#1096'.'
          DataBinding.FieldName = 'AGDATEEND'
          Width = 79
        end
        object tvAgrAGDATECLOSE: TcxGridDBColumn
          Caption = #1044#1072#1090#1072' '#1087#1088#1077#1078#1076'. '#1088#1072#1089#1090#1086#1088#1078'.'
          DataBinding.FieldName = 'AGDATECLOSE'
          Width = 93
        end
        object tvAgrAGNOTECLOSE: TcxGridDBColumn
          Caption = #1055#1088#1080#1095#1080#1085#1072' '#1088#1072#1089#1090'.'
          DataBinding.FieldName = 'AGNOTECLOSE'
          Width = 77
        end
        object tvAgrAGNOTE: TcxGridDBColumn
          Caption = #1050#1086#1084#1084#1077#1085#1090' '#1082' '#1076#1086#1075'.'
          DataBinding.FieldName = 'AGNOTE'
          Width = 79
        end
        object tvAgrISSCAN: TcxGridDBColumn
          Caption = #1050#1086#1087#1080#1103
          DataBinding.FieldName = 'ISSCAN'
          PropertiesClassName = 'TcxCheckBoxProperties'
          Properties.ReadOnly = True
          Properties.ValueChecked = 1
          Properties.ValueUnchecked = 0
          Width = 78
        end
      end
      object cxGridLevel1: TcxGridLevel
        GridView = tvAgr
      end
    end
    object cxLabel1: TcxLabel
      Left = 1
      Top = 1
      Align = alTop
      Caption = 
        #1042#1099#1073#1077#1088#1080#1090#1077' '#1076#1086#1075#1086#1074#1086#1088' ('#1076#1074#1086#1081#1085#1099#1084' '#1082#1083#1080#1082#1086#1084' '#1084#1099#1096#1082#1080'), '#1082' '#1082#1086#1090#1086#1088#1086#1084#1091' '#1089#1086#1079#1076#1072#1077#1090#1077' '#1076#1086#1087 +
        '. '#1089#1086#1075#1083#1072#1096#1077#1085#1080#1077':'
      ParentFont = False
      Style.Font.Charset = DEFAULT_CHARSET
      Style.Font.Color = clCream
      Style.Font.Height = -16
      Style.Font.Name = 'Tahoma'
      Style.Font.Style = []
      Style.IsFontAssigned = True
    end
  end
  inherited dlgDS: TDataSource
    DataSet = qR
  end
  object qR: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      
        'SELECT R.*,  RD.*, ST.STNAME AS usluga, SC.SCID, SC.SCISDELETE, ' +
        'SC.SCTIMEENTER,'
      
        'p1.plastname || '#39' '#39' || SUBSTRING(p1.pname FROM 1 FOR 1) || '#39'. '#39' ' +
        '|| COALESCE(SUBSTRING(p1.ppatronymic FROM 1 FOR 1) || '#39'.'#39', '#39' '#39') ' +
        'AS autor_otkaza,'
      
        'p2.plastname || '#39' '#39' || SUBSTRING(p2.pname FROM 1 FOR 1) || '#39'. '#39' ' +
        '|| COALESCE(SUBSTRING(p2.ppatronymic FROM 1 FOR 1) || '#39'.'#39', '#39' '#39') ' +
        'AS autor_sc,'
      
        'p3.plastname || '#39' '#39' || SUBSTRING(p3.pname FROM 1 FOR 1) || '#39'. '#39' ' +
        '|| COALESCE(SUBSTRING(p3.ppatronymic FROM 1 FOR 1) || '#39'.'#39', '#39' '#39') ' +
        'AS udalil_sc,'
      
        'p4.plastname || '#39' '#39' || p4.pname|| '#39' '#39' || COALESCE(p4.ppatronymic' +
        ', '#39' '#39') AS fio_poluch,'
      
        'p5.plastname || '#39' '#39' || p5.pname|| '#39' '#39' || COALESCE(p5.ppatronymic' +
        ', '#39' '#39') AS fio_dl,'
      'TRIM(case'
      
        'WHEN (RD.RDISOTKAZ is NULL) AND (SC.SCID IS NULL) then '#39#1053#1077#1088#1072#1089#1089#1084#1086 +
        #1090#1088#1077#1085#1085#1072#1103#39
      'WHEN (rd.RDISOTKAZ = 1) then '#39#1054#1090#1082#1072#1079#39
      
        'WHEN (SC.SCID IS NOT NULL) AND (SC.SCISDELETE is NULL) then '#39#1057#1086#1079 +
        #1076#1072#1085#1086' '#1076#1086#1087'. '#1089#1086#1075#1083#1072#1096'. '#8470#39'||SC.SCID'
      
        'WHEN (SC.SCID IS NOT NULL) AND (SC.SCISDELETE is NOT NULL) then ' +
        #39#1059#1076#1072#1083#1077#1085#1086' '#1076#1086#1087'. '#1089#1086#1075#1083#1072#1096'. '#8470#39'||SC.SCID'
      'END) AS sost,'
      'TRIM( case'
      'WHEN (RD.RDISOTKAZ is NULL) AND (SC.SCID IS NULL) then NULL'
      
        'WHEN (rd.RDISOTKAZ = 1) then p1.plastname || '#39' '#39' || SUBSTRING(p1' +
        '.pname FROM 1 FOR 1) || '#39'. '#39' || COALESCE(SUBSTRING(p1.ppatronymi' +
        'c FROM 1 FOR 1) || '#39'.'#39', '#39' '#39')'
      
        'WHEN (SC.SCID IS NOT NULL) AND (SC.SCISDELETE is NULL) then p2.p' +
        'lastname || '#39' '#39' || SUBSTRING(p2.pname FROM 1 FOR 1) || '#39'. '#39' || C' +
        'OALESCE(SUBSTRING(p2.ppatronymic FROM 1 FOR 1) || '#39'.'#39', '#39' '#39')'
      
        'WHEN (SC.SCID IS NOT NULL) AND (SC.SCISDELETE is NOT NULL) then ' +
        'p3.plastname || '#39' '#39' || SUBSTRING(p3.pname FROM 1 FOR 1) || '#39'. '#39' ' +
        '|| COALESCE(SUBSTRING(p3.ppatronymic FROM 1 FOR 1) || '#39'.'#39', '#39' '#39')'
      'END) AS sost_autor, SD.SDNAME AS podr,'
      
        'IIF(RSO.RID IS NOT NULL, 1, 0) AS scan1, IIF(RSO1.RID IS NOT NUL' +
        'L, 1, 0) AS scan2'
      'FROM REQUEST R'
      'INNER JOIN REQUEST_DEF RD ON RD.RID = R.RID'
      'INNER JOIN SERVICES_TYPE ST ON ST.STID = RD.STID'
      
        'LEFT OUTER JOIN REQUEST_SCAN RS ON RS.RID = R.RID AND RS.RSTYPE ' +
        '= 1'
      
        'LEFT OUTER JOIN REQUEST_SCAN RS1 ON RS1.RID = R.RID AND RS1.RSTY' +
        'PE = 2'
      'LEFT OUTER JOIN SPEC_COND SC ON SC.SCID = RD.SCID'
      'LEFT OUTER JOIN USERS U1 ON U1.USNAME = RD.RDUSEREDIT'
      'LEFT OUTER JOIN PEOPLE P1 ON P1.PID = U1.PID'
      'LEFT OUTER JOIN USERS U2 ON U2.USNAME = SC.SCUSERENTER'
      'LEFT OUTER JOIN PEOPLE P2 ON P2.PID = U2.PID'
      'LEFT OUTER JOIN USERS U3 ON U3.USNAME = SC.SCUSEREDIT'
      'LEFT OUTER JOIN PEOPLE P3 ON P3.PID = U3.PID'
      'LEFT OUTER JOIN PEOPLE P4 ON P4.PID = R.PID_POLUCH'
      'LEFT OUTER JOIN PEOPLE P5 ON P5.PID = R.PID'
      
        'LEFT OUTER JOIN DETI_PODRAZD DP ON DP.PID = R.PID_POLUCH AND CUR' +
        'RENT_DATE BETWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp' +
        '.DPDATEOUT AS DATE), CURRENT_DATE+3650)'
      'LEFT OUTER JOIN SYS_DIC SD ON SD.SDID = DP.SDID'
      
        'LEFT OUTER JOIN REQUEST_SCAN RSO ON RSO.RID = R.RID AND RSO.RSTY' +
        'PE = 1'
      
        'LEFT OUTER JOIN REQUEST_SCAN RSO1 ON RSO1.RID = R.RID AND RSO1.R' +
        'STYPE = 2')
    Left = 288
    object qRRID: TIntegerField
      FieldName = 'RID'
      Origin = '"REQUEST"."RID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qRPID_POLUCH: TIntegerField
      FieldName = 'PID_POLUCH'
      Origin = '"REQUEST"."PID_POLUCH"'
    end
    object qRPID: TIntegerField
      FieldName = 'PID'
      Origin = '"REQUEST"."PID"'
    end
    object qRRUSERENTER: TIBStringField
      FieldName = 'RUSERENTER'
      Origin = '"REQUEST"."RUSERENTER"'
      Size = 40
    end
    object qRRTIMEENTER: TDateTimeField
      FieldName = 'RTIMEENTER'
      Origin = '"REQUEST"."RTIMEENTER"'
    end
    object qRRUSEREDIT: TIBStringField
      FieldName = 'RUSEREDIT'
      Origin = '"REQUEST"."RUSEREDIT"'
      Size = 40
    end
    object qRRTIMEEDIT: TDateTimeField
      FieldName = 'RTIMEEDIT'
      Origin = '"REQUEST"."RTIMEEDIT"'
    end
    object qRRNOTE: TIBStringField
      FieldName = 'RNOTE'
      Origin = '"REQUEST"."RNOTE"'
      Size = 255
    end
    object qRRDATE: TDateField
      FieldName = 'RDATE'
      Origin = '"REQUEST"."RDATE"'
    end
    object qRRISDELETE: TIntegerField
      FieldName = 'RISDELETE'
      Origin = '"REQUEST"."RISDELETE"'
    end
    object qRRDID: TIntegerField
      FieldName = 'RDID'
      Origin = '"REQUEST_DEF"."RDID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qRRID1: TIntegerField
      FieldName = 'RID1'
      Origin = '"REQUEST_DEF"."RID"'
    end
    object qRSCID: TIntegerField
      FieldName = 'SCID'
      Origin = '"REQUEST_DEF"."SCID"'
    end
    object qRRDUSERENTER: TIBStringField
      FieldName = 'RDUSERENTER'
      Origin = '"REQUEST_DEF"."RDUSERENTER"'
      Size = 40
    end
    object qRRDTIMEENTER: TDateTimeField
      FieldName = 'RDTIMEENTER'
      Origin = '"REQUEST_DEF"."RDTIMEENTER"'
    end
    object qRRDUSEREDIT: TIBStringField
      FieldName = 'RDUSEREDIT'
      Origin = '"REQUEST_DEF"."RDUSEREDIT"'
      Size = 40
    end
    object qRRDTIMEEDIT: TDateTimeField
      FieldName = 'RDTIMEEDIT'
      Origin = '"REQUEST_DEF"."RDTIMEEDIT"'
    end
    object qRRDNOTE: TIBStringField
      FieldName = 'RDNOTE'
      Origin = '"REQUEST_DEF"."RDNOTE"'
      Size = 255
    end
    object qRRDBEGIN: TDateField
      FieldName = 'RDBEGIN'
      Origin = '"REQUEST_DEF"."RDBEGIN"'
    end
    object qRRDEND: TDateField
      FieldName = 'RDEND'
      Origin = '"REQUEST_DEF"."RDEND"'
    end
    object qRRDCOUNT: TIntegerField
      FieldName = 'RDCOUNT'
      Origin = '"REQUEST_DEF"."RDCOUNT"'
    end
    object qRRDISOTKAZ: TIntegerField
      FieldName = 'RDISOTKAZ'
      Origin = '"REQUEST_DEF"."RDISOTKAZ"'
    end
    object qRUSLUGA: TIBStringField
      FieldName = 'USLUGA'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object qRSCID1: TIntegerField
      FieldName = 'SCID1'
      Origin = '"SPEC_COND"."SCID"'
    end
    object qRSCISDELETE: TIntegerField
      FieldName = 'SCISDELETE'
      Origin = '"SPEC_COND"."SCISDELETE"'
    end
    object qRSCTIMEENTER: TDateTimeField
      FieldName = 'SCTIMEENTER'
      Origin = '"SPEC_COND"."SCTIMEENTER"'
    end
    object qRAUTOR_OTKAZA: TIBStringField
      FieldName = 'AUTOR_OTKAZA'
      ProviderFlags = []
      Size = 769
    end
    object qRAUTOR_SC: TIBStringField
      FieldName = 'AUTOR_SC'
      ProviderFlags = []
      Size = 769
    end
    object qRUDALIL_SC: TIBStringField
      FieldName = 'UDALIL_SC'
      ProviderFlags = []
      Size = 769
    end
    object qRFIO_POLUCH: TIBStringField
      FieldName = 'FIO_POLUCH'
      ProviderFlags = []
      Size = 769
    end
    object qRFIO_DL: TIBStringField
      FieldName = 'FIO_DL'
      ProviderFlags = []
      Size = 769
    end
    object qRSOST: TIBStringField
      FieldName = 'SOST'
      ProviderFlags = []
      Size = 33
    end
    object qRSOST_AUTOR: TIBStringField
      FieldName = 'SOST_AUTOR'
      ProviderFlags = []
      Size = 769
    end
    object qRSTID: TIntegerField
      FieldName = 'STID'
      Origin = '"REQUEST_DEF"."STID"'
    end
    object qRPODR: TIBStringField
      FieldName = 'PODR'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object qRSCAN1: TIntegerField
      FieldName = 'SCAN1'
      ProviderFlags = []
    end
    object qRSCAN2: TIntegerField
      FieldName = 'SCAN2'
      ProviderFlags = []
    end
  end
  object sqldelR: TIBSQL
    Database = DMInv.DBRead
    SQL.Strings = (
      'update request RF set rf.risdelete = 1 where rf.rid = :rid')
    Transaction = DMInv.IBTransaction1
    Left = 216
  end
  object sqlOtkaz: TIBSQL
    Database = DMInv.DBRead
    SQL.Strings = (
      'UPDATE REQUEST_DEF RD SET RD.RDISOTKAZ = cast(:value as integer)'
      'WHERE RD.RDID = :RDID')
    Transaction = DMInv.IBTransaction1
    Left = 328
  end
  object qAgr: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    CachedUpdates = True
    DataSource = dlgDS
    SQL.Strings = (
      'SELECT UN.*, LIST(UN.podp, '#39', '#39')'
      'FROM'
      '('
      
        'SELECT A.*,  (P_res.PLASTNAME||'#39' '#39'||P_res.PNAME||'#39' '#39'||COALESCE(P' +
        '_res.PPATRONYMIC,'#39' '#39')) AS P_RECIPIENT,'
      '     IIF (S.AGID IS NULL, 0, 1) AS ISSCAN, P_res.PDATEBIRTH,'
      '     SD.SDNAME AS FORMA,'
      
        '     ('#39', '#1087#1088#1086#1078#1080#1074#1072#1102#1097#1077#1081'('#1075#1086') '#1087#1086' '#1072#1076#1088#1077#1089#1091': '#39'||COALESCE(k.NAME||'#39' , '#39'||k' +
        's.NAME||'#39' , '#39'||ci.CIVALUE, ci.CIVALUE)) AS adress,'
      ''
      
        '    CAST( LIST(DISTINCT (P.PLASTNAME||'#39' '#39'||P.PNAME||'#39' '#39'||COALESC' +
        'E(P.PPATRONYMIC,'#39' '#39')), '#39', '#39') AS VARCHAR(2048)) AS podp'
      'FROM AGREEMENTS A'
      'LEFT OUTER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = A.AGID'
      'LEFT OUTER JOIN PEOPLE P_res ON P_res.PID = APU.PID'
      'LEFT OUTER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE P ON P.PID = AP.PID'
      'LEFT OUTER JOIN SYS_DIC SD ON SD.SDID = A.AGFORMTYPE'
      'LEFT OUTER JOIN A_SCAN S ON S.AGID = A.AGID'
      
        'LEFT OUTER JOIN CONTACTINFO CI ON CI.PID = APU.PID AND CI.CITYPE' +
        ' = 1153'
      'LEFT OUTER JOIN KLADR_STREET_MO ks ON ks.KSID = CI.KSID'
      'LEFT OUTER JOIN KLADR_MO k ON k.KID = ci.KID'
      ''
      'WHERE a.AGISDELETE IS NULL '
      'AND APU.PID = :PID'
      
        'GROUP BY 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,2' +
        '2, 23,24'
      'UNION'
      
        'SELECT A.*,  (P_res.PLASTNAME||'#39' '#39'||P_res.PNAME||'#39' '#39'||COALESCE(P' +
        '_res.PPATRONYMIC,'#39' '#39')) AS P_RECIPIENT,'
      '     IIF (S.AGID IS NULL, 0, 1) AS ISSCAN, P_res.PDATEBIRTH,'
      '     SD.SDNAME AS FORMA, AP.ID_JURIDICAL_FACE,'
      
        '     ('#39', '#1087#1088#1086#1078#1080#1074#1072#1102#1097#1077#1081'('#1075#1086') '#1087#1086' '#1072#1076#1088#1077#1089#1091': '#39'||COALESCE(k.NAME||'#39' , '#39'||k' +
        's.NAME||'#39' , '#39'||ci.CIVALUE, ci.CIVALUE)) AS adress'
      'FROM AGREEMENTS A'
      'LEFT OUTER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = A.AGID'
      'LEFT OUTER JOIN PEOPLE P_res ON P_res.PID = APU.PID'
      
        'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID AND AP.POTYPE = ' +
        '1'
      'LEFT OUTER JOIN SYS_DIC SD ON SD.SDID = A.AGFORMTYPE'
      'LEFT OUTER JOIN A_SCAN S ON S.AGID = A.AGID'
      
        'LEFT OUTER JOIN CONTACTINFO CI ON CI.PID = APU.PID AND CI.CITYPE' +
        ' = 1153'
      ''
      'LEFT OUTER JOIN KLADR_STREET_MO ks ON ks.KSID = CI.KSID'
      'LEFT OUTER JOIN KLADR_MO k ON k.KID = ci.KID'
      ''
      'WHERE a.AGISDELETE IS NULL '
      'AND APU.PID = :PID'
      ''
      ') AS UN'
      
        'GROUP BY 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,2' +
        '2,23,24,25')
    GeneratorField.Field = 'AGID'
    GeneratorField.Generator = 'GEN_AGREEMENTS'
    Left = 264
    Top = 152
    ParamData = <
      item
        DataType = ftInteger
        Name = 'PID'
        ParamType = ptUnknown
        Size = 4
      end
      item
        DataType = ftInteger
        Name = 'PID'
        ParamType = ptUnknown
      end>
    object qAgrAGID: TIntegerField
      FieldName = 'AGID'
      Origin = '"AGREEMENTS"."AGID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qAgrAGNUM_N: TIntegerField
      FieldName = 'AGNUM_N'
      Origin = '"AGREEMENTS"."AGNUM_N"'
    end
    object qAgrAGNUM: TIBStringField
      FieldName = 'AGNUM'
      Origin = '"AGREEMENTS"."AGNUM"'
      Size = 40
    end
    object qAgrAGDATE: TDateField
      FieldName = 'AGDATE'
      Origin = '"AGREEMENTS"."AGDATE"'
    end
    object qAgrAGDATEEND: TDateField
      FieldName = 'AGDATEEND'
      Origin = '"AGREEMENTS"."AGDATEEND"'
    end
    object qAgrAGFORMTYPE: TIntegerField
      FieldName = 'AGFORMTYPE'
      Origin = '"AGREEMENTS"."AGFORMTYPE"'
    end
    object qAgrAGNOTE: TIBStringField
      FieldName = 'AGNOTE'
      Origin = '"AGREEMENTS"."AGNOTE"'
      Size = 255
    end
    object qAgrAGDATECLOSE: TDateField
      FieldName = 'AGDATECLOSE'
      Origin = '"AGREEMENTS"."AGDATECLOSE"'
    end
    object qAgrAGNOTECLOSE: TIBStringField
      FieldName = 'AGNOTECLOSE'
      Origin = '"AGREEMENTS"."AGNOTECLOSE"'
      Size = 255
    end
    object qAgrAGUSERENTER: TIBStringField
      FieldName = 'AGUSERENTER'
      Origin = '"AGREEMENTS"."AGUSERENTER"'
      Size = 40
    end
    object qAgrAGTIMEENTER: TDateTimeField
      FieldName = 'AGTIMEENTER'
      Origin = '"AGREEMENTS"."AGTIMEENTER"'
    end
    object qAgrAGUSEREDIT: TIBStringField
      FieldName = 'AGUSEREDIT'
      Origin = '"AGREEMENTS"."AGUSEREDIT"'
      Size = 40
    end
    object qAgrAGTIMEEDIT: TDateTimeField
      FieldName = 'AGTIMEEDIT'
      Origin = '"AGREEMENTS"."AGTIMEEDIT"'
    end
    object qAgrAGISDELETE: TIntegerField
      FieldName = 'AGISDELETE'
      Origin = '"AGREEMENTS"."AGISDELETE"'
    end
    object qAgrP_RECIPIENT: TIBStringField
      FieldName = 'P_RECIPIENT'
      ProviderFlags = []
      Size = 767
    end
    object qAgrISSCAN: TIntegerField
      FieldName = 'ISSCAN'
      ProviderFlags = []
    end
    object qAgrPDATEBIRTH: TDateField
      FieldName = 'PDATEBIRTH'
      Origin = '"PEOPLE"."PDATEBIRTH"'
    end
    object qAgrFORMA: TIBStringField
      FieldName = 'FORMA'
      ProviderFlags = []
      Size = 255
    end
    object qAgrLIST: TMemoField
      FieldName = 'LIST'
      ProviderFlags = []
      BlobType = ftMemo
      Size = 8
    end
    object qAgrAGUSERREGISTER: TIBStringField
      FieldName = 'AGUSERREGISTER'
      Origin = '"AGREEMENTS"."AGUSERREGISTER"'
      Size = 40
    end
    object qAgrAGDATEREGISTER: TDateTimeField
      FieldName = 'AGDATEREGISTER'
      Origin = '"AGREEMENTS"."AGDATEREGISTER"'
    end
    object qAgrAGISNEEDRESIGN: TIntegerField
      FieldName = 'AGISNEEDRESIGN'
      Origin = '"AGREEMENTS"."AGISNEEDRESIGN"'
    end
    object qAgrAGPODRTYPE: TIntegerField
      FieldName = 'AGPODRTYPE'
      Origin = '"AGREEMENTS"."AGPODRTYPE"'
    end
    object qAgrAGDATEBEGIN: TDateField
      FieldName = 'AGDATEBEGIN'
      ProviderFlags = []
    end
    object qAgrPODP: TIBStringField
      FieldName = 'PODP'
      ProviderFlags = []
      Size = 2048
    end
    object qAgrADRESS: TIBStringField
      FieldName = 'ADRESS'
      ProviderFlags = []
      Size = 284
    end
  end
  object qChekSCNum: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    DataSource = dsAgr
    SQL.Strings = (
      'SELECT COUNT(SC.SCID) AS SCNUM_N'
      'FROM SPEC_COND SC'
      'WHERE SC.AGID = :AGID'
      '')
    Left = 307
    Top = 152
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'AGID'
        ParamType = ptUnknown
      end>
    object qChekSCNumSCNUM_N: TIntegerField
      FieldName = 'SCNUM_N'
      ProviderFlags = []
    end
  end
  object qSpecCond: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    AfterInsert = qSpecCondAfterInsert
    CachedUpdates = True
    DataSource = dsAgr
    SQL.Strings = (
      
        'SELECT DISTINCT sc.*, IIF(s.scid IS NULL, 0, 1) AS isscan, sd.sd' +
        'name AS actualn, stp.*, ser.*,'
      
        '                IIF(stp.stperiodoplaty = 1, '#39#1059#1095#1077#1073#1085#1099#1081' '#1090#1088#1080#1084#1077#1089#1090#1088'.'#39',' +
        ' '#39#1052#1077#1089#1103#1094'.'#39') AS minperiod, sd_edizmer.sdname AS edizme,'
      
        '                CAST(IIF(a.agpodrtype = 0, '#39#1042#1086#1089#1087#1080#1090#1072#1085#1085#1080#1082#39', '#39#1059#1095#1077#1085#1080 +
        #1082#39') AS VARCHAR(20)) AS vospit,'
      '                CASE stp.sttype'
      '                  WHEN 0 THEN '#39#1056#1072#1079#1086#1074#1072#1103#39
      '                  WHEN 1 THEN '#39#1054#1089#1085#1086#1074#1085'.'#39
      '                  WHEN 2 THEN '#39#1044#1086#1087#1086#1083#1085#1080#1090'.'#39
      '                END AS tip,'
      '                CAST(IIF(stp.sttype <> 0,'
      '                CASE stp.stperiodoplaty'
      '                  WHEN 0 THEN '#39#1052#1077#1089#1103#1094#39
      '                  WHEN 1 THEN '#39#1058#1088#1080#1084#1077#1089#1090#1088#39
      '                END, '#39#1053#1077#1090#39') AS VARCHAR(50)) AS period,'
      
        '                (stp.sttarif - sc.sctarifwithdiscount) AS skidka' +
        ','
      
        '                p1.plastname || '#39' '#39' || SUBSTRING(p1.pname FROM 1' +
        ' FOR 1) || '#39'. '#39' || COALESCE(SUBSTRING(p1.ppatronymic FROM 1 FOR ' +
        '1) || '#39'.'#39', '#39' '#39') AS autor,'
      '                IIF(sc.sctimeedit > ser.stimeedit,'
      
        '                (p3.plastname || '#39' '#39' || SUBSTRING(p3.pname FROM ' +
        '1 FOR 1) || '#39'. '#39' || COALESCE(SUBSTRING(p3.ppatronymic FROM 1 FOR' +
        ' 1) || '#39'.'#39', '#39' '#39')),'
      
        '                (p2.plastname || '#39' '#39' || SUBSTRING(p2.pname FROM ' +
        '1 FOR 1) || '#39'. '#39' || COALESCE(SUBSTRING(p2.ppatronymic FROM 1 FOR' +
        ' 1) || '#39'.'#39', '#39' '#39'))) AS edit_user,'
      '                EXTRACT(YEAR FROM sc.scdateend) AS scy'
      'FROM spec_cond sc'
      'LEFT OUTER JOIN services ser ON ser.scid = sc.scid'
      'LEFT OUTER JOIN services_type stp ON stp.stid = ser.stid'
      'LEFT OUTER JOIN sc_scan s ON s.scid = sc.scid'
      'LEFT OUTER JOIN scactualn sca ON sca.scid = sc.scid'
      'LEFT OUTER JOIN sys_dic sd ON sd.sdid = sca.sdid'
      
        'LEFT OUTER JOIN sys_dic sd_edizmer ON sd_edizmer.sdid = stp.sted' +
        'izmer'
      'LEFT OUTER JOIN agreements a ON a.agid = sc.agid'
      'LEFT OUTER JOIN users u ON u.usname = sc.scuserenter'
      'LEFT OUTER JOIN people p1 ON p1.pid = u.pid'
      'LEFT OUTER JOIN users u1 ON u1.usname = ser.suseredit'
      'LEFT OUTER JOIN people p2 ON p2.pid = u1.pid'
      'LEFT OUTER JOIN users u2 ON u2.usname = sc.scuseredit'
      'LEFT OUTER JOIN people p3 ON p3.pid = u2.pid'
      'INNER JOIN(SELECT t2.sdid'
      
        '           FROM (WITH RECURSIVE tree (sdname, sdid, sdparid, o) ' +
        'AS (SELECT sd.sdname, sd.sdid, sd.sdparid,'
      '           CAST('#39#39' AS VARCHAR(2048)) AS o'
      '           FROM sys_dic sd'
      '           WHERE sd.sdparid = 1880'
      '           UNION ALL'
      '           SELECT sd1.sdname, sd1.sdid, sd1.sdparid, '#39#39' || o'
      '           FROM sys_dic sd1'
      
        '           INNER JOIN tree t ON t.sdid = sd1.sdparid) SELECT o |' +
        '| sdname AS sdname,'
      '           sdid,'
      '           sdparid'
      'FROM tree t) AS t2) AS sd_usl ON sd_usl.sdid = stp.sdid'
      'WHERE sc.agid = :agid AND'
      '      sc.scisdelete IS NULL'
      'ORDER BY sc.scnum_n  ')
    UpdateObject = quSpecCond
    GeneratorField.Field = 'SCID'
    GeneratorField.Generator = 'GEN_SPEC_COND'
    Left = 264
    Top = 184
    ParamData = <
      item
        DataType = ftInteger
        Name = 'AGID'
        ParamType = ptUnknown
        Size = 4
      end>
    object qSpecCondSCID: TIntegerField
      FieldName = 'SCID'
      Origin = '"SPEC_COND"."SCID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qSpecCondSCNUM_N: TIntegerField
      FieldName = 'SCNUM_N'
      Origin = '"SPEC_COND"."SCNUM_N"'
    end
    object qSpecCondAGID: TIntegerField
      FieldName = 'AGID'
      Origin = '"SPEC_COND"."AGID"'
      Required = True
    end
    object qSpecCondSCNUMBER: TIBStringField
      FieldName = 'SCNUMBER'
      Origin = '"SPEC_COND"."SCNUMBER"'
      Size = 40
    end
    object qSpecCondSCDATE: TDateField
      FieldName = 'SCDATE'
      Origin = '"SPEC_COND"."SCDATE"'
    end
    object qSpecCondSCDATEEND: TDateField
      FieldName = 'SCDATEEND'
      Origin = '"SPEC_COND"."SCDATEEND"'
    end
    object qSpecCondSCNOTE: TIBStringField
      FieldName = 'SCNOTE'
      Origin = '"SPEC_COND"."SCNOTE"'
      Size = 255
    end
    object qSpecCondSCUSERENTER: TIBStringField
      FieldName = 'SCUSERENTER'
      Origin = '"SPEC_COND"."SCUSERENTER"'
      Size = 40
    end
    object qSpecCondSCTIMEENTER: TDateTimeField
      FieldName = 'SCTIMEENTER'
      Origin = '"SPEC_COND"."SCTIMEENTER"'
    end
    object qSpecCondSCUSEREDIT: TIBStringField
      FieldName = 'SCUSEREDIT'
      Origin = '"SPEC_COND"."SCUSEREDIT"'
      Size = 40
    end
    object qSpecCondSCTIMEEDIT: TDateTimeField
      FieldName = 'SCTIMEEDIT'
      Origin = '"SPEC_COND"."SCTIMEEDIT"'
    end
    object qSpecCondSCISDELETE: TIntegerField
      FieldName = 'SCISDELETE'
      Origin = '"SPEC_COND"."SCISDELETE"'
    end
    object qSpecCondISSCAN: TIntegerField
      FieldName = 'ISSCAN'
      ProviderFlags = []
    end
    object qSpecCondSCDISCOUNTAUTORISATION: TIBStringField
      FieldName = 'SCDISCOUNTAUTORISATION'
      Origin = '"SPEC_COND"."SCDISCOUNTAUTORISATION"'
      Size = 40
    end
    object qSpecCondSCDATEREGISTER: TDateTimeField
      FieldName = 'SCDATEREGISTER'
      Origin = '"SPEC_COND"."SCDATEREGISTER"'
    end
    object qSpecCondSCUSERREGISTER: TIBStringField
      FieldName = 'SCUSERREGISTER'
      Origin = '"SPEC_COND"."SCUSERREGISTER"'
      Size = 40
    end
    object qSpecCondSCDISCOUNT: TIBBCDField
      FieldName = 'SCDISCOUNT'
      Origin = '"SPEC_COND"."SCDISCOUNT"'
      DisplayFormat = '#,###0'
      EditFormat = '0'
      Precision = 18
      Size = 2
    end
    object qSpecCondSCTYPEOFDISCOUNT: TIntegerField
      FieldName = 'SCTYPEOFDISCOUNT'
      Origin = '"SPEC_COND"."SCTYPEOFDISCOUNT"'
    end
    object qSpecCondSCISNEEDRESIGN: TIntegerField
      FieldName = 'SCISNEEDRESIGN'
      Origin = '"SPEC_COND"."SCISNEEDRESIGN"'
    end
    object qSpecCondSCDISCOUNTNOTE: TIBStringField
      FieldName = 'SCDISCOUNTNOTE'
      Origin = '"SPEC_COND"."SCDISCOUNTNOTE"'
      Size = 255
    end
    object qSpecCondACTUALN: TIBStringField
      FieldName = 'ACTUALN'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object qSpecCondSCTYPEOFDISC: TIntegerField
      FieldName = 'SCTYPEOFDISC'
      Origin = '"SPEC_COND"."SCTYPEOFDISC"'
    end
    object qSpecCondSTID: TIntegerField
      FieldName = 'STID'
      Origin = '"SERVICES_TYPE"."STID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
    end
    object qSpecCondSTNAME: TIBStringField
      DisplayLabel = #1059#1089#1083#1091#1075#1072
      FieldName = 'STNAME'
      Origin = '"SERVICES_TYPE"."STNAME"'
      Size = 255
    end
    object qSpecCondSTTYPE: TIntegerField
      FieldName = 'STTYPE'
      Origin = '"SERVICES_TYPE"."STTYPE"'
    end
    object qSpecCondSTEDIZMER: TIntegerField
      FieldName = 'STEDIZMER'
      Origin = '"SERVICES_TYPE"."STEDIZMER"'
    end
    object qSpecCondSTDESCR: TIBStringField
      FieldName = 'STDESCR'
      Origin = '"SERVICES_TYPE"."STDESCR"'
      Size = 2048
    end
    object qSpecCondSTTARIF: TIBBCDField
      FieldName = 'STTARIF'
      Origin = '"SERVICES_TYPE"."STTARIF"'
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qSpecCondSTDATEBEGIN: TDateField
      FieldName = 'STDATEBEGIN'
      Origin = '"SERVICES_TYPE"."STDATEBEGIN"'
    end
    object qSpecCondSTDATEEND: TDateField
      FieldName = 'STDATEEND'
      Origin = '"SERVICES_TYPE"."STDATEEND"'
    end
    object qSpecCondSTTIME: TTimeField
      FieldName = 'STTIME'
      Origin = '"SERVICES_TYPE"."STTIME"'
    end
    object qSpecCondSTPODRTYPE: TIntegerField
      FieldName = 'STPODRTYPE'
      Origin = '"SERVICES_TYPE"."STPODRTYPE"'
    end
    object qSpecCondSTNOTE: TIBStringField
      FieldName = 'STNOTE'
      Origin = '"SERVICES_TYPE"."STNOTE"'
      Size = 255
    end
    object qSpecCondSTISARCHIVE: TIntegerField
      FieldName = 'STISARCHIVE'
      Origin = '"SERVICES_TYPE"."STISARCHIVE"'
    end
    object qSpecCondSTISDELETE: TIntegerField
      FieldName = 'STISDELETE'
      Origin = '"SERVICES_TYPE"."STISDELETE"'
    end
    object qSpecCondSTUSERENTER: TIBStringField
      FieldName = 'STUSERENTER'
      Origin = '"SERVICES_TYPE"."STUSERENTER"'
      Size = 40
    end
    object qSpecCondSTTIMEENTER: TDateTimeField
      FieldName = 'STTIMEENTER'
      Origin = '"SERVICES_TYPE"."STTIMEENTER"'
    end
    object qSpecCondSTUSEREDIT: TIBStringField
      FieldName = 'STUSEREDIT'
      Origin = '"SERVICES_TYPE"."STUSEREDIT"'
      Size = 40
    end
    object qSpecCondSTTIMEEDIT: TDateTimeField
      FieldName = 'STTIMEEDIT'
      Origin = '"SERVICES_TYPE"."STTIMEEDIT"'
    end
    object qSpecCondSCDATEBEGIN: TDateField
      FieldName = 'SCDATEBEGIN'
      Origin = '"SPEC_COND"."SCDATEBEGIN"'
    end
    object qSpecCondSNOTE: TIBStringField
      FieldName = 'SNOTE'
      Origin = '"SERVICES"."SNOTE"'
      Size = 255
    end
    object qSpecCondSTIMEBEGIN: TTimeField
      FieldName = 'STIMEBEGIN'
      Origin = '"SERVICES"."STIMEBEGIN"'
    end
    object qSpecCondSTIMEEND: TTimeField
      FieldName = 'STIMEEND'
      Origin = '"SERVICES"."STIMEEND"'
    end
    object qSpecCondSCMINPERIOD: TIntegerField
      FieldName = 'SCMINPERIOD'
      Origin = '"SPEC_COND"."SCMINPERIOD"'
    end
    object qSpecCondSCOUNT: TIntegerField
      FieldName = 'SCOUNT'
      Origin = '"SERVICES"."SCOUNT"'
    end
    object qSpecCondEDIZME: TIBStringField
      FieldName = 'EDIZME'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object qSpecCondSCTARIF: TIBBCDField
      FieldName = 'SCTARIF'
      Origin = '"SPEC_COND"."SCTARIF"'
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qSpecCondSCTARIFWITHDISCOUNT: TIBBCDField
      FieldName = 'SCTARIFWITHDISCOUNT'
      Origin = '"SPEC_COND"."SCTARIFWITHDISCOUNT"'
      DisplayFormat = '#,###0'
      EditFormat = '0'
      Precision = 18
      Size = 2
    end
    object qSpecCondSCAMOUNT: TIBBCDField
      FieldName = 'SCAMOUNT'
      Origin = '"SPEC_COND"."SCAMOUNT"'
      DisplayFormat = '#,###0'
      EditFormat = '0'
      Precision = 18
      Size = 2
    end
    object qSpecCondSCBALANCE: TIBBCDField
      FieldName = 'SCBALANCE'
      Origin = '"SPEC_COND"."SCBALANCE"'
      DisplayFormat = '#,###0'
      EditFormat = '0'
      Precision = 18
      Size = 2
    end
    object qSpecCondSCDATARASCH: TIntegerField
      FieldName = 'SCDATARASCH'
      Origin = '"SPEC_COND"."SCDATARASCH"'
    end
    object qSpecCondVOSPIT: TIBStringField
      FieldName = 'VOSPIT'
      ProviderFlags = []
      FixedChar = True
      Size = 11
    end
    object qSpecCondSDID: TIntegerField
      FieldName = 'SDID'
      Origin = '"SERVICES_TYPE"."SDID"'
    end
    object qSpecCondTIP: TIBStringField
      FieldName = 'TIP'
      ProviderFlags = []
      FixedChar = True
      Size = 9
    end
    object qSpecCondSKIDKA: TIBBCDField
      FieldName = 'SKIDKA'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qSpecCondAUTOR: TIBStringField
      FieldName = 'AUTOR'
      ProviderFlags = []
      Size = 769
    end
    object qSpecCondSCDATERASTORJ: TDateField
      FieldName = 'SCDATERASTORJ'
      Origin = '"SPEC_COND"."SCDATERASTORJ"'
    end
    object qSpecCondEDIT_USER: TIBStringField
      FieldName = 'EDIT_USER'
      ProviderFlags = []
      Size = 769
    end
    object qSpecCondMINPERIOD: TIBStringField
      FieldName = 'MINPERIOD'
      ProviderFlags = []
      FixedChar = True
      Size = 22
    end
    object qSpecCondPOID: TIntegerField
      FieldName = 'POID'
      Origin = '"SPEC_COND"."POID"'
    end
    object qSpecCondPERIOD: TIBStringField
      FieldName = 'PERIOD'
      ProviderFlags = []
      Size = 50
    end
    object qSpecCondSCISGRAFEDIT: TIntegerField
      FieldName = 'SCISGRAFEDIT'
      Origin = '"SPEC_COND"."SCISGRAFEDIT"'
    end
    object qSpecCondSCY: TSmallintField
      FieldName = 'SCY'
      ProviderFlags = []
    end
    object qSpecCondSCAPPROVED: TIntegerField
      FieldName = 'SCAPPROVED'
      Origin = '"SPEC_COND"."SCAPPROVED"'
    end
  end
  object quSpecCond: TIBUpdateSQL
    RefreshSQL.Strings = (
      'Select '
      '  SCID,'
      '  SCNUM_N,'
      '  AGID,'
      '  SCNUMBER,'
      '  SCDATE,'
      '  SCDATEEND,'
      '  SCNOTE,'
      '  SCISDELETE,'
      '  SCISNEEDRESIGN,'
      '  SCUSERENTER,'
      '  SCTIMEENTER,'
      '  SCUSEREDIT,'
      '  SCTIMEEDIT,'
      '  SCDATEREGISTER,'
      '  SCUSERREGISTER,'
      '  SCDISCOUNT,'
      '  SCTYPEOFDISCOUNT,'
      '  SCDISCOUNTNOTE,'
      '  SCDISCOUNTAUTORISATION,'
      '  SCTYPEOFDISC,'
      '  SCDATEBEGIN,'
      '  SCMINPERIOD,'
      '  SCTARIF,'
      '  SCTARIFWITHDISCOUNT,'
      '  SCAMOUNT,'
      '  SCBALANCE,'
      '  SCDATARASCH,'
      '  SCDATERASTORJ,'
      '  POID,'
      '  SCISGRAFEDIT,'
      '  ISSCAN,'
      '  ACTUALN,'
      '  STID,'
      '  STNAME,'
      '  STTYPE,'
      '  STEDIZMER,'
      '  STDESCR,'
      '  STTARIF,'
      '  STDATEBEGIN,'
      '  STDATEEND,'
      '  STTIME,'
      '  STNOTE,'
      '  STISDELETE,'
      '  STUSERENTER,'
      '  STTIMEENTER,'
      '  STUSEREDIT,'
      '  STTIMEEDIT,'
      '  STPODRTYPE,'
      '  STISARCHIVE,'
      '  STPODR,'
      '  STPERIODOPLATY,'
      '  SDID,'
      '  SID,'
      '  SCID1,'
      '  STID1,'
      '  SCOUNT,'
      '  SNOTE,'
      '  STIMEBEGIN,'
      '  STIMEEND,'
      '  SUSERENTER,'
      '  STIMEENTER,'
      '  SUSEREDIT,'
      '  STIMEEDIT,'
      '  SISDELETE,'
      '  MINPERIOD,'
      '  EDIZME,'
      '  VOSPIT,'
      '  TIP,'
      '  PERIOD,'
      '  DOLGNY_ZAPL,'
      '  SKIDKA,'
      '  BALANCE,'
      '  AUTOR,'
      '  ZAPL_ALL,'
      '  EDIT_USER'
      'from SPEC_COND '
      'where'
      '  SCID = :SCID')
    ModifySQL.Strings = (
      'update SPEC_COND'
      'set'
      '  AGID = :AGID,'
      '  POID = :POID,'
      '  SCAMOUNT = :SCAMOUNT,'
      '  SCBALANCE = :SCBALANCE,'
      '  SCDATARASCH = :SCDATARASCH,'
      '  SCDATE = :SCDATE,'
      '  SCDATEBEGIN = :SCDATEBEGIN,'
      '  SCDATEEND = :SCDATEEND,'
      '  SCDATERASTORJ = :SCDATERASTORJ,'
      '  SCDATEREGISTER = :SCDATEREGISTER,'
      '  SCDISCOUNT = :SCDISCOUNT,'
      '  SCDISCOUNTAUTORISATION = :SCDISCOUNTAUTORISATION,'
      '  SCDISCOUNTNOTE = :SCDISCOUNTNOTE,'
      '  SCID = :SCID,'
      '  SCISDELETE = :SCISDELETE,'
      '  SCISGRAFEDIT = :SCISGRAFEDIT,'
      '  SCISNEEDRESIGN = :SCISNEEDRESIGN,'
      '  SCMINPERIOD = :SCMINPERIOD,'
      '  SCNOTE = :SCNOTE,'
      '  SCNUM_N = :SCNUM_N,'
      '  SCNUMBER = :SCNUMBER,'
      '  SCTARIF = :SCTARIF,'
      '  SCTARIFWITHDISCOUNT = :SCTARIFWITHDISCOUNT,'
      '  SCTIMEEDIT = :SCTIMEEDIT,'
      '  SCTIMEENTER = :SCTIMEENTER,'
      '  SCTYPEOFDISC = :SCTYPEOFDISC,'
      '  SCTYPEOFDISCOUNT = :SCTYPEOFDISCOUNT,'
      '  SCUSEREDIT = :SCUSEREDIT,'
      '  SCUSERENTER = :SCUSERENTER,'
      '  SCUSERREGISTER = :SCUSERREGISTER'
      'where'
      '  SCID = :OLD_SCID')
    InsertSQL.Strings = (
      'insert into SPEC_COND'
      
        '  (AGID, POID, SCAMOUNT, SCBALANCE, SCDATARASCH, SCDATE, SCDATEB' +
        'EGIN, SCDATEEND, '
      
        '   SCDATERASTORJ, SCDATEREGISTER, SCDISCOUNT, SCDISCOUNTAUTORISA' +
        'TION, SCDISCOUNTNOTE, '
      
        '   SCID, SCISDELETE, SCISGRAFEDIT, SCISNEEDRESIGN, SCMINPERIOD, ' +
        'SCNOTE, '
      
        '   SCNUM_N, SCNUMBER, SCTARIF, SCTARIFWITHDISCOUNT, SCTIMEEDIT, ' +
        'SCTIMEENTER, '
      
        '   SCTYPEOFDISC, SCTYPEOFDISCOUNT, SCUSEREDIT, SCUSERENTER, SCUS' +
        'ERREGISTER)'
      'values'
      
        '  (:AGID, :POID, :SCAMOUNT, :SCBALANCE, :SCDATARASCH, :SCDATE, :' +
        'SCDATEBEGIN, '
      
        '   :SCDATEEND, :SCDATERASTORJ, :SCDATEREGISTER, :SCDISCOUNT, :SC' +
        'DISCOUNTAUTORISATION, '
      
        '   :SCDISCOUNTNOTE, :SCID, :SCISDELETE, :SCISGRAFEDIT, :SCISNEED' +
        'RESIGN, '
      
        '   :SCMINPERIOD, :SCNOTE, :SCNUM_N, :SCNUMBER, :SCTARIF, :SCTARI' +
        'FWITHDISCOUNT, '
      
        '   :SCTIMEEDIT, :SCTIMEENTER, :SCTYPEOFDISC, :SCTYPEOFDISCOUNT, ' +
        ':SCUSEREDIT, '
      '   :SCUSERENTER, :SCUSERREGISTER)')
    DeleteSQL.Strings = (
      'update SPEC_COND'
      'set'
      '  SCISDELETE = 1'
      'where'
      '  SCID = :OLD_SCID')
    Left = 307
    Top = 184
  end
  object dsAgr: TDataSource
    DataSet = qAgr
    Left = 232
    Top = 152
  end
  object sqlAddSCID: TIBSQL
    Database = DMInv.DBRead
    SQL.Strings = (
      'UPDATE REQUEST_DEF RD SET RD.SCID = CAST(:SCID AS INTEGER)'
      'WHERE RD.RDID = :RDID')
    Transaction = DMInv.IBTransaction1
    Left = 368
  end
  object frRequest: TfrxReport
    Version = '4.9.32'
    DotMatrixReport = False
    IniFile = '\Software\Fast Reports'
    PreviewOptions.Buttons = [pbPrint, pbLoad, pbSave, pbExport, pbZoom, pbFind, pbOutline, pbPageSetup, pbTools, pbEdit, pbNavigator, pbExportQuick]
    PreviewOptions.Zoom = 1.000000000000000000
    PrintOptions.Printer = 'Default'
    PrintOptions.PrintOnSheet = 0
    ReportOptions.CreateDate = 40757.596164513900000000
    ReportOptions.LastChange = 40757.671480081020000000
    ScriptLanguage = 'PascalScript'
    StoreInDFM = False
    Left = 376
    Top = 168
  end
  object frDS_R: TfrxDBDataset
    UserName = 'R'
    CloseDataSource = False
    DataSet = qR
    BCDToCurrency = False
    Left = 408
    Top = 168
  end
  object qRD: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    DataSource = dlgDS
    SQL.Strings = (
      'SELECT RD.*, STP.STNAME AS usluga'
      'FROM REQUEST_DEF RD'
      'INNER JOIN services_type stp ON stp.stid = rd.STID'
      'WHERE RD.RID = :RID')
    Left = 448
    Top = 208
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'RID'
        ParamType = ptUnknown
      end>
  end
  object frDS_RD: TfrxDBDataset
    UserName = 'RD'
    CloseDataSource = False
    DataSet = qRD
    BCDToCurrency = False
    Left = 408
    Top = 208
  end
  object frxPDFExport1: TfrxPDFExport
    UseFileCache = True
    ShowProgress = True
    OverwritePrompt = False
    PrintOptimized = False
    Outline = False
    Background = False
    HTMLTags = True
    Author = 'FastReport'
    Subject = 'FastReport PDF export'
    ProtectionFlags = [ePrint, eModify, eCopy, eAnnot]
    HideToolbar = False
    HideMenubar = False
    HideWindowUI = False
    FitWindow = False
    CenterWindow = False
    PrintScaling = False
    Left = 408
    Top = 248
  end
  object frxXLSExport1: TfrxXLSExport
    UseFileCache = True
    ShowProgress = True
    OverwritePrompt = False
    ExportEMF = True
    AsText = False
    Background = True
    FastExport = True
    PageBreaks = True
    EmptyLines = True
    SuppressPageHeadersFooters = False
    Left = 440
    Top = 248
  end
  object frxRichObject1: TfrxRichObject
    Left = 408
    Top = 288
  end
  object qTmp: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      
        'SELECT R.*,  RD.*, ST.STNAME AS usluga, SC.SCID, SC.SCISDELETE, ' +
        'SC.SCTIMEENTER,'
      
        'p1.plastname || '#39' '#39' || SUBSTRING(p1.pname FROM 1 FOR 1) || '#39'. '#39' ' +
        '|| COALESCE(SUBSTRING(p1.ppatronymic FROM 1 FOR 1) || '#39'.'#39', '#39' '#39') ' +
        'AS autor_otkaza,'
      
        'p2.plastname || '#39' '#39' || SUBSTRING(p2.pname FROM 1 FOR 1) || '#39'. '#39' ' +
        '|| COALESCE(SUBSTRING(p2.ppatronymic FROM 1 FOR 1) || '#39'.'#39', '#39' '#39') ' +
        'AS autor_sc,'
      
        'p3.plastname || '#39' '#39' || SUBSTRING(p3.pname FROM 1 FOR 1) || '#39'. '#39' ' +
        '|| COALESCE(SUBSTRING(p3.ppatronymic FROM 1 FOR 1) || '#39'.'#39', '#39' '#39') ' +
        'AS udalil_sc,'
      
        'p4.plastname || '#39' '#39' || p4.pname|| '#39' '#39' || COALESCE(p4.ppatronymic' +
        ', '#39' '#39') AS fio_poluch,'
      
        'p5.plastname || '#39' '#39' || p5.pname|| '#39' '#39' || COALESCE(p5.ppatronymic' +
        ', '#39' '#39') AS fio_dl,'
      'TRIM(case'
      
        'WHEN (RD.RDISOTKAZ is NULL) AND (SC.SCID IS NULL) then '#39#1053#1077#1088#1072#1089#1089#1084#1086 +
        #1090#1088#1077#1085#1085#1072#1103#39
      'WHEN (rd.RDISOTKAZ = 1) then '#39#1054#1090#1082#1072#1079#39
      
        'WHEN (SC.SCID IS NOT NULL) AND (SC.SCISDELETE is NULL) then '#39#1057#1086#1079 +
        #1076#1072#1085#1086' '#1076#1086#1087'. '#1089#1086#1075#1083#1072#1096'. '#8470#39'||SC.SCID'
      
        'WHEN (SC.SCID IS NOT NULL) AND (SC.SCISDELETE is NOT NULL) then ' +
        #39#1059#1076#1072#1083#1077#1085#1086' '#1076#1086#1087'. '#1089#1086#1075#1083#1072#1096'. '#8470#39'||SC.SCID'
      'END) AS sost,'
      'TRIM( case'
      'WHEN (RD.RDISOTKAZ is NULL) AND (SC.SCID IS NULL) then NULL'
      
        'WHEN (rd.RDISOTKAZ = 1) then p1.plastname || '#39' '#39' || SUBSTRING(p1' +
        '.pname FROM 1 FOR 1) || '#39'. '#39' || COALESCE(SUBSTRING(p1.ppatronymi' +
        'c FROM 1 FOR 1) || '#39'.'#39', '#39' '#39')'
      
        'WHEN (SC.SCID IS NOT NULL) AND (SC.SCISDELETE is NULL) then p2.p' +
        'lastname || '#39' '#39' || SUBSTRING(p2.pname FROM 1 FOR 1) || '#39'. '#39' || C' +
        'OALESCE(SUBSTRING(p2.ppatronymic FROM 1 FOR 1) || '#39'.'#39', '#39' '#39')'
      
        'WHEN (SC.SCID IS NOT NULL) AND (SC.SCISDELETE is NOT NULL) then ' +
        'p3.plastname || '#39' '#39' || SUBSTRING(p3.pname FROM 1 FOR 1) || '#39'. '#39' ' +
        '|| COALESCE(SUBSTRING(p3.ppatronymic FROM 1 FOR 1) || '#39'.'#39', '#39' '#39')'
      'END) AS sost_autor, SD.SDNAME AS podr,'
      
        'IIF(RSO.RID IS NOT NULL, 1, 0) AS scan1, IIF(RSO1.RID IS NOT NUL' +
        'L, 1, 0) AS scan2'
      'FROM REQUEST R'
      'INNER JOIN REQUEST_DEF RD ON RD.RID = R.RID'
      'INNER JOIN SERVICES_TYPE ST ON ST.STID = RD.STID'
      
        'LEFT OUTER JOIN REQUEST_SCAN RS ON RS.RID = R.RID AND RS.RSTYPE ' +
        '= 1'
      
        'LEFT OUTER JOIN REQUEST_SCAN RS1 ON RS1.RID = R.RID AND RS1.RSTY' +
        'PE = 2'
      'LEFT OUTER JOIN SPEC_COND SC ON SC.SCID = RD.SCID'
      'LEFT OUTER JOIN USERS U1 ON U1.USNAME = RD.RDUSEREDIT'
      'LEFT OUTER JOIN PEOPLE P1 ON P1.PID = U1.PID'
      'LEFT OUTER JOIN USERS U2 ON U2.USNAME = SC.SCUSERENTER'
      'LEFT OUTER JOIN PEOPLE P2 ON P2.PID = U2.PID'
      'LEFT OUTER JOIN USERS U3 ON U3.USNAME = SC.SCUSEREDIT'
      'LEFT OUTER JOIN PEOPLE P3 ON P3.PID = U3.PID'
      'LEFT OUTER JOIN PEOPLE P4 ON P4.PID = R.PID_POLUCH'
      'LEFT OUTER JOIN PEOPLE P5 ON P5.PID = R.PID'
      
        'LEFT OUTER JOIN DETI_PODRAZD DP ON DP.PID = R.PID_POLUCH AND CUR' +
        'RENT_DATE BETWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp' +
        '.DPDATEOUT AS DATE), CURRENT_DATE+3650)'
      'LEFT OUTER JOIN SYS_DIC SD ON SD.SDID = DP.SDID'
      
        'LEFT OUTER JOIN REQUEST_SCAN RSO ON RSO.RID = R.RID AND RSO.RSTY' +
        'PE = 1'
      
        'LEFT OUTER JOIN REQUEST_SCAN RSO1 ON RSO1.RID = R.RID AND RSO1.R' +
        'STYPE = 2')
    Left = 288
    Top = 40
    object IntegerField1: TIntegerField
      FieldName = 'RID'
      Origin = '"REQUEST"."RID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object IntegerField2: TIntegerField
      FieldName = 'PID_POLUCH'
      Origin = '"REQUEST"."PID_POLUCH"'
    end
    object IntegerField3: TIntegerField
      FieldName = 'PID'
      Origin = '"REQUEST"."PID"'
    end
    object IBStringField1: TIBStringField
      FieldName = 'RUSERENTER'
      Origin = '"REQUEST"."RUSERENTER"'
      Size = 40
    end
    object DateTimeField1: TDateTimeField
      FieldName = 'RTIMEENTER'
      Origin = '"REQUEST"."RTIMEENTER"'
    end
    object IBStringField2: TIBStringField
      FieldName = 'RUSEREDIT'
      Origin = '"REQUEST"."RUSEREDIT"'
      Size = 40
    end
    object DateTimeField2: TDateTimeField
      FieldName = 'RTIMEEDIT'
      Origin = '"REQUEST"."RTIMEEDIT"'
    end
    object IBStringField3: TIBStringField
      FieldName = 'RNOTE'
      Origin = '"REQUEST"."RNOTE"'
      Size = 255
    end
    object DateField1: TDateField
      FieldName = 'RDATE'
      Origin = '"REQUEST"."RDATE"'
    end
    object IntegerField4: TIntegerField
      FieldName = 'RISDELETE'
      Origin = '"REQUEST"."RISDELETE"'
    end
    object IntegerField5: TIntegerField
      FieldName = 'RDID'
      Origin = '"REQUEST_DEF"."RDID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object IntegerField6: TIntegerField
      FieldName = 'RID1'
      Origin = '"REQUEST_DEF"."RID"'
    end
    object IntegerField7: TIntegerField
      FieldName = 'SDID'
      Origin = '"REQUEST_DEF"."SDID"'
    end
    object IntegerField8: TIntegerField
      FieldName = 'SCID'
      Origin = '"REQUEST_DEF"."SCID"'
    end
    object IBStringField4: TIBStringField
      FieldName = 'RDUSERENTER'
      Origin = '"REQUEST_DEF"."RDUSERENTER"'
      Size = 40
    end
    object DateTimeField3: TDateTimeField
      FieldName = 'RDTIMEENTER'
      Origin = '"REQUEST_DEF"."RDTIMEENTER"'
    end
    object IBStringField5: TIBStringField
      FieldName = 'RDUSEREDIT'
      Origin = '"REQUEST_DEF"."RDUSEREDIT"'
      Size = 40
    end
    object DateTimeField4: TDateTimeField
      FieldName = 'RDTIMEEDIT'
      Origin = '"REQUEST_DEF"."RDTIMEEDIT"'
    end
    object IBStringField6: TIBStringField
      FieldName = 'RDNOTE'
      Origin = '"REQUEST_DEF"."RDNOTE"'
      Size = 255
    end
    object DateField2: TDateField
      FieldName = 'RDBEGIN'
      Origin = '"REQUEST_DEF"."RDBEGIN"'
    end
    object DateField3: TDateField
      FieldName = 'RDEND'
      Origin = '"REQUEST_DEF"."RDEND"'
    end
    object IntegerField9: TIntegerField
      FieldName = 'RDCOUNT'
      Origin = '"REQUEST_DEF"."RDCOUNT"'
    end
    object IntegerField10: TIntegerField
      FieldName = 'RDISOTKAZ'
      Origin = '"REQUEST_DEF"."RDISOTKAZ"'
    end
    object IBStringField7: TIBStringField
      FieldName = 'USLUGA'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object IntegerField11: TIntegerField
      FieldName = 'SCID1'
      Origin = '"SPEC_COND"."SCID"'
    end
    object IntegerField12: TIntegerField
      FieldName = 'SCISDELETE'
      Origin = '"SPEC_COND"."SCISDELETE"'
    end
    object DateTimeField5: TDateTimeField
      FieldName = 'SCTIMEENTER'
      Origin = '"SPEC_COND"."SCTIMEENTER"'
    end
    object IBStringField8: TIBStringField
      FieldName = 'AUTOR_OTKAZA'
      ProviderFlags = []
      Size = 769
    end
    object IBStringField9: TIBStringField
      FieldName = 'AUTOR_SC'
      ProviderFlags = []
      Size = 769
    end
    object IBStringField10: TIBStringField
      FieldName = 'UDALIL_SC'
      ProviderFlags = []
      Size = 769
    end
    object IBStringField11: TIBStringField
      FieldName = 'FIO_POLUCH'
      ProviderFlags = []
      Size = 769
    end
    object IBStringField12: TIBStringField
      FieldName = 'FIO_DL'
      ProviderFlags = []
      Size = 769
    end
    object IBStringField13: TIBStringField
      FieldName = 'SOST'
      ProviderFlags = []
      Size = 33
    end
    object IBStringField14: TIBStringField
      FieldName = 'SOST_AUTOR'
      ProviderFlags = []
      Size = 769
    end
  end
  object qPermission: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      'SELECT UP.PID'
      'FROM USER_PERMISSIONS UP'
      'WHERE UP.PID = :pid AND UP.UPGROUPID = :GROUPID')
    Left = 648
    Top = 224
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'pid'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'GROUPID'
        ParamType = ptUnknown
      end>
  end
  object qCheckSC: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      'SELECT SC.SCID'
      'FROM SPEC_COND SC'
      'INNER JOIN SERVICES S ON S.SCID = SC.SCID'
      'INNER JOIN SERVICES_TYPE st ON st.STID = S.STID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = SC.AGID'
      'WHERE APU.PID = :pid_poluch'
      '    AND S.STID = :STID'
      '    AND'
      '    (SC.SCDATEBEGIN <= :date2'
      '    AND SC.SCDATEEND >= :date1)'
      '    AND SC.SCISDELETE IS NULL'
      '    AND st.STTYPE <> 0')
    Left = 312
    Top = 312
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'pid_poluch'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'STID'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'date2'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'date1'
        ParamType = ptUnknown
      end>
  end
end
